package com.base.cn.platform.os.controller.agent.income;

import com.base.cn.platform.os.common.AdminBaseController;
import com.base.cn.platform.os.service.course.agent.income.AgentIncomeInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Map;

/**
 * 推广员收益明细Controller
 *
 * @author LIZHIPENG
 * @create 2018-05-14 上午 10:12
 */
@Controller
@RequestMapping("/admin/agent/income")
public class AdminIncomeInfoController extends AdminBaseController {

    @Autowired
    private AgentIncomeInfoService agentIncomeInfoService;

    /**
     * 查询推广员的收益明细列表
     * @param model
     * @param params 条件
     * @return
     */
    @RequestMapping("/queryAgentIncomeInfoList")
    public String queryAgentIncomeInfoList(Model model,
                                           @RequestParam(value = "currentPage", required = false, defaultValue = "1")int currentPage,
                                           @RequestBody Map<String, Object> params){
        Map<String, Object> dataMap = agentIncomeInfoService.queryIncomeInfoListPage(currentPage, params, true, true);
        model.addAttribute("dataMap", dataMap);
        return resultPage("/agent/income/agent-income-info-list");
    }
}
